{{include file="public/header" /}}

<!-- right content start  -->
<div class="content-right">
    <div class="content">
        <!-- form start -->
        <form class="am-form form-validation form-search" method="post" action="{{:MyUrl('admin/goodscomments/index')}}" request-type="form">
            <div class="thin">
                <div class="am-input-group am-input-group-sm am-fl so">
                    <input type="text" autocomplete="off" name="keywords" class="am-radius" placeholder="用户名/昵称/手机/邮箱/商品标题" value="{{if !empty($params.keywords)}}{{$params.keywords}}{{/if}}" />
                    <span class="am-input-group-btn">
                        <button class="am-btn am-btn-default am-radius" type="submit" data-am-loading="{spinner:'circle-o-notch', loadingText:'搜索中...'}">搜索</button>
                    </span>
                </div>
                <label class="am-fl thin_sub more-submit">
                    更多筛选条件
                    {{if isset($params['is_more']) and $params['is_more'] eq 1}}
                        <input type="checkbox" name="is_more" value="1" id="is_more" checked />
                        <i class="am-icon-angle-up"></i>
                    {{else /}}
                        <input type="checkbox" name="is_more" value="1" id="is_more" />
                        <i class="am-icon-angle-down"></i>
                    {{/if}}
                </label>
            </div>
            <table class="so-list more-where {{if !isset($params['is_more'])}}none{{/if}}">
                <tbody>
                    <tr>
                        <td>
                            <span>显隐：</span>
                            <select name="is_show" class="chosen-select" data-placeholder="是否显示...">
                                <option value="-1">是否显示...</option>
                                {{foreach $common_is_show_list as $v}}
                                    <option value="{{$v.id}}" {{if isset($params['is_show']) and $params['is_show'] eq $v['id']}}selected{{/if}}>{{$v.name}}</option>
                                {{/foreach}}
                            </select>
                        </td>
                        <td>
                            <span>回复：</span>
                            <select name="is_reply" class="chosen-select" data-placeholder="是否回复...">
                                <option value="-1">是否回复...</option>
                                {{if !empty($common_is_text_list)}}
                                    {{foreach $common_is_text_list as $v}}
                                        <option value="{{$v.id}}" {{if isset($params['is_reply']) and $params['is_reply'] eq $v['id']}}selected{{/if}}>{{$v.name}}</option>
                                    {{/foreach}}
                                {{/if}}
                            </select>
                        </td>
                    </tr>
                    <tr>
                        <td>
                            <span>匿名：</span>
                            <select name="is_anonymous" class="chosen-select" data-placeholder="是否匿名...">
                                <option value="-1">是否匿名...</option>
                                {{foreach $common_is_text_list as $v}}
                                    <option value="{{$v.id}}" {{if isset($params['is_anonymous']) and $params['is_anonymous'] eq $v['id']}}selected{{/if}}>{{$v.name}}</option>
                                {{/foreach}}
                            </select>
                        </td>
                        <td>
                            <span>类型：</span>
                            <select name="business_type" class="chosen-select" data-placeholder="业务类型...">
                                <option value="">业务类型...</option>
                                {{if !empty($common_goods_rating_business_type_list)}}
                                    {{foreach $common_goods_rating_business_type_list as $k=>$v}}
                                        <option value="{{$k}}" {{if isset($params['business_type']) and $params['business_type'] eq $k}}selected{{/if}}>{{$v}}</option>
                                    {{/foreach}}
                                {{/if}}
                            </select>
                        </td>
                    </tr>
                    <tr>
                        <td class="time">
                            <span>时间：</span>
                            <span>
                                <input type="text" autocomplete="off" name="time_start" class="am-form-field am-input-sm am-radius Wdate" placeholder="起始时间" value="{{if !empty($params.time_start)}}{{$params.time_start}}{{/if}}" data-validation-message="日期格式有误" onclick="WdatePicker({firstDayOfWeek:1,dateFmt:'yyyy-MM-dd'})" autocomplete="off" /><i class="am-icon-calendar"></i>
                            </span>
                            <em class="text-grey">~</em>
                            <span>
                                <input type="text" autocomplete="off" name="time_end" class="am-form-field am-input-sm am-radius Wdate" placeholder="结束时间" value="{{if !empty($params.time_end)}}{{$params.time_end}}{{/if}}" pattern="^[0-9]{4}-[0-9]{2}-[0-9]{2}$" data-validation-message="日期格式有误" onclick="WdatePicker({firstDayOfWeek:1,dateFmt:'yyyy-MM-dd'})" autocomplete="off" /><i class="am-icon-calendar"></i>
                            </span>
                        </td>
                        <td>
                            <button type="submit" class="am-btn am-btn-primary am-radius am-btn-xs btn-loading-example" data-am-loading="{spinner:'circle-o-notch', loadingText:'搜索中...'}">搜索</button>
                            <a href="{{:MyUrl('admin/goodscomments/index')}}" class="am-btn am-btn-warning am-radius am-btn-sm reset-submit">清除条件</a>
                        </td>
                    </tr>
                </tbody>
            </table>
        </form>
        <!-- form end -->

        <!-- top operation start -->
        <div class="am-g am-margin-top-sm">
            <!-- 顶部操作钩子 -->
            {{if isset($shopxo_is_develop) and $shopxo_is_develop eq true and (!isset($is_footer) or $is_footer eq 1)}}
                <div class="plugins-tag">
                    <span>plugins_view_admin_goods_comments_top_operation</span>
                </div>
            {{/if}}
            {{php}}
                $hook_name = 'plugins_view_admin_goods_comments_top_operation';
                $hook_data = Hook::listen($hook_name, ['hook_name'=>$hook_name, 'is_backend'=>true]);
                if(!empty($hook_data) && is_array($hook_data))
                {
                    foreach($hook_data as $hook)
                    {
                        if(is_string($hook) || is_int($hook))
                        {
                            echo htmlspecialchars_decode($hook);
                        }
                    }
                }
            {{/php}}
        </div>
        <!-- top operation end -->

        <!-- list start -->
        <table class="am-table am-table-striped am-table-hover am-text-middle am-margin-top-sm">
            <thead>
                <tr>
                    <th class="am-hide-md-down">商品信息</th>
                    <th class="am-hide-md-down">用户信息</th>
                    <th class="am-hide-sm-only">业务类型</th>
                    <th>评论内容</th>
                    <th class="am-hide-sm-only">评论图片</th>
                    <th class="am-hide-sm-only">评分</th>
                    <th class="am-hide-sm-only">回复</th>
                    <th class="am-hide-sm-only">匿名</th>
                    <th class="am-hide-sm-only">显示</th>
                    <th>更多</th>
                    <th>操作</th>
                </tr>
            </thead>
            <tbody>
                {{if !empty($data_list)}}
                    {{foreach $data_list as $v}}
                        <tr id="data-list-{{$v.id}}" {{if $v['is_show'] eq 0}}class="am-active"{{/if}}>
                            <td class="goods-info am-hide-md-down">
                                {{if !empty($v['goods'])}}
                                    <div class="base">
                                        <a href="{{$v.goods.goods_url}}" target="_blank">
                                            <img src="{{$v.goods.images}}" alt="{{$v.goods.title}}" class="am-img-thumbnail am-radius am-align-left" />
                                        </a>
                                        <a class="am-text-top" href="{{$v.goods.goods_url}}" target="_blank">{{$v.goods.title}}</a>
                                    </div>
                                    <p>{{$price_symbol}}{{$v.goods.price}}</p>
                                {{else /}}
                                    商品信息异常
                                {{/if}}
                            </td>
                            <td class="user-info am-hide-md-down">
                                {{if !empty($v['user'])}}
                                    <img src="{{$v.user.avatar}}" alt="{{$v.user.user_name_view}}" class="am-img-thumbnail am-radius am-align-left" />
                                    <ul class="user-base">
                                        <li>名称：{{if empty($v['user']['username'])}}<span class="cr-ccc">未填写</span>{{else /}}{{$v.user.username}}{{/if}}</li>
                                        <li>昵称：{{if empty($v['user']['nickname'])}}<span class="cr-ccc">未填写</span>{{else /}}{{$v.user.nickname}}{{/if}}</li>
                                        <li>手机：{{if empty($v['user']['mobile'])}}<span class="cr-ccc">未填写</span>{{else /}}{{$v.user.mobile}}{{/if}}</li>
                                        <li>邮箱：{{if empty($v['user']['email'])}}<span class="cr-ccc">未填写</span>{{else /}}{{$v.user.email}}{{/if}}</li>
                                    </ul>
                                {{else /}}
                                    用户信息异常
                                {{/if}}
                            </td>
                            <td class="am-hide-sm-only">{{$v.business_type_text}}</td>
                            <td class="content-info">
                                <div class="reply-content">
                                    {{$v.content}}
                                </div>
                            </td>
                            <td class="am-hide-sm-only">
                                {{if !empty($v['images'])}}
                                    <div data-am-widget="slider" class="am-slider am-slider-a1" data-am-slider='{&quot;directionNav&quot;:false, slideshow:false}' >
                                        <ul class="am-slides">
                                            {{foreach $v.images as $img}}
                                                <li>
                                                    <a href="{{$img}}" target="_blank">
                                                        <img src="{{$img}}" />
                                                    </a>
                                                </li>
                                            {{/foreach}}
                                        </ul>
                                    </div>
                                {{/if}}
                            </td>
                            <td class="am-hide-sm-only">
                                <span class="am-badge am-radius {{$common_goods_comments_rating_list[$v['rating']]['badge']}}">{{$v.rating_text}}</span>
                            </td>
                            <td class="am-hide-sm-only">
                                <a href="javascript:;" class="am-icon-btn am-icon-check submit-state {{if $v['is_reply'] eq 1}}am-success{{else /}}am-default{{/if}}" data-url="{{:MyUrl('admin/goodscomments/statusupdate')}}" data-id="{{$v.id}}" data-state="{{$v['is_reply']}}" data-field="is_reply"></a>
                            </td>
                            <td class="am-hide-sm-only">
                                <a href="javascript:;" class="am-icon-btn am-icon-check submit-state {{if $v['is_anonymous'] eq 1}}am-success{{else /}}am-default{{/if}}" data-url="{{:MyUrl('admin/goodscomments/statusupdate')}}" data-id="{{$v.id}}" data-state="{{$v['is_anonymous']}}" data-field="is_anonymous"></a>
                            </td>
                            <td class="am-hide-sm-only">
                                <a href="javascript:;" class="am-icon-btn am-icon-check submit-state {{if $v['is_show'] eq 1}}am-success{{else /}}am-default{{/if}}" data-url="{{:MyUrl('admin/goodscomments/statusupdate')}}" data-id="{{$v.id}}" data-state="{{$v['is_show']}}" data-field="is_show" data-is-update-status="1"></a>
                            </td>
                            <td>
                                <span class="am-icon-caret-down c-p" data-am-modal="{target: '#my-popup{{$v.id}}'}"> 查看更多</span>
                                <div class="am-popup am-radius" id="my-popup{{$v.id}}">
                                    <div class="am-popup-inner">
                                        <div class="am-popup-hd">
                                            <h4 class="am-popup-title">详情内容</h4>
                                            <span data-am-modal-close
                                            class="am-close">&times;</span>
                                        </div>
                                        <div class="am-popup-bd">
                                            <dl class="dl-content">
                                                <dt>商品信息</dt>
                                                <dd class="goods-info am-hide-md-down">
                                                    {{if !empty($v['goods'])}}
                                                        <div class="base">
                                                            <a href="{{$v.goods.goods_url}}" target="_blank">
                                                                <img src="{{$v.goods.images}}" alt="{{$v.goods.title}}" class="am-img-thumbnail am-radius am-align-left" />
                                                            </a>
                                                            <a class="am-text-top" href="{{$v.goods.goods_url}}" target="_blank">{{$v.goods.title}}</a>
                                                        </div>
                                                        <p>{{$price_symbol}}{{$v.goods.price}}</p>
                                                    {{else /}}
                                                        商品信息异常
                                                    {{/if}}
                                                </dd>

                                                <dt>用户信息</dt>
                                                <dd class="user-info">
                                                    {{if !empty($v['user'])}}
                                                        <img src="{{$v.user.avatar}}" alt="{{$v.user.user_name_view}}" class="am-img-thumbnail am-radius am-align-left" />
                                                        <ul class="user-base">
                                                            <li>名称：{{if empty($v['user']['username'])}}<span class="cr-ccc">未填写</span>{{else /}}{{$v.user.username}}{{/if}}</li>
                                                            <li>昵称：{{if empty($v['user']['nickname'])}}<span class="cr-ccc">未填写</span>{{else /}}{{$v.user.nickname}}{{/if}}</li>
                                                            <li>手机：{{if empty($v['user']['mobile'])}}<span class="cr-ccc">未填写</span>{{else /}}{{$v.user.mobile}}{{/if}}</li>
                                                            <li>邮箱：{{if empty($v['user']['email'])}}<span class="cr-ccc">未填写</span>{{else /}}{{$v.user.email}}{{/if}}</li>
                                                        </ul>
                                                    {{else /}}
                                                        用户信息异常
                                                    {{/if}}
                                                </dd>

                                                <dt>业务类型</dt>
                                                <dd>{{$v.business_type_text}}</dd>

                                                <dt>评论内容</dt>
                                                <dd>{{$v.content}}</dd>

                                                <dt>评论图片</dt>
                                                <dd>
                                                    {{if !empty($v['images'])}}
                                                        {{foreach $v.images as $img}}
                                                            <a href="{{$img}}" target="_blank">
                                                                <img src="{{$img}}" class="am-img-thumbnail" width="80" height="80" />
                                                            </a>
                                                        {{/foreach}}
                                                    {{/if}}
                                                </dd>

                                                <dt>评分</dt>
                                                <dd>
                                                    <span class="am-badge am-radius {{$common_goods_comments_rating_list[$v['rating']]['badge']}}">{{$v.rating_text}}</span>
                                                </dd>

                                                <dt>是否匿名</dt>
                                                <dd>{{$v.is_anonymous_text}}</dd>

                                                <dt>是否显示</dt>
                                                <dd>{{if empty($v['is_show_text'])}}<span class="cr-ddd">未填写</span>{{else /}}{{$v.is_show_text}}{{/if}}</dd>

                                                <dt>是否回复</dt>
                                                <dd>{{$v.is_reply_text}}</dd>

                                                <dt>回复内容</dt>
                                                <dd>
                                                    {{if $v['is_reply'] eq 1 and !empty($v['reply'])}}
                                                        <div class="reply-content">
                                                            {{$v.reply}}
                                                        </div>
                                                    {{else /}}
                                                        <span class="cr-ddd">未回复</span>
                                                    {{/if}}
                                                </dd>

                                                <dt>回复时间</dt>
                                                <dd>{{$v.reply_time_time}}</dd>

                                                <dt>更新时间</dt>
                                                <dd>{{$v.upd_time_time}}</dd>

                                                <dt>创建时间</dt>
                                                <dd>{{$v.add_time_time}}</dd>
                                            </dl>
                                        </div>
                                    </div>
                                </div>
                            </td>
                            <td class="view-operation">
                                <a href="{{:MyUrl('admin/goodscomments/saveinfo', array_merge($params, ['id'=>$v['id']]))}}" class="am-btn am-btn-secondary am-btn-xs am-radius am-btn-block am-icon-edit"> 编辑</a>
                                {{if $v['is_reply'] eq 0}}
                                    <button class="am-btn am-btn-success am-btn-xs am-radius am-btn-block submit-reply am-icon-gavel" data-am-modal="{target: '#my-popup-reply'}" data-json='{{:json_encode($v)}}'> 回复</button>
                                {{/if}}
                                <button class="am-btn am-btn-danger am-btn-xs am-radius am-btn-block am-icon-trash-o submit-delete" data-url="{{:MyUrl('admin/goodscomments/delete')}}" data-id="{{$v.id}}"> 删除</button>

                                <!-- 商品评论列表操作钩子 -->
                                {{if isset($shopxo_is_develop) and $shopxo_is_develop eq true and (!isset($is_footer) or $is_footer eq 1)}}
                                    <div class="plugins-tag">
                                        <span>plugins_view_admin_goods_comments_list_operation</span>
                                    </div>
                                {{/if}}
                                {{php}}
                                    $hook_name = 'plugins_view_admin_goods_comments_list_operation';
                                    $hook_data = Hook::listen($hook_name, ['hook_name'=>$hook_name, 'is_backend'=>true, 'id'=>$v['id'], 'data'=>$v]);
                                    if(!empty($hook_data) && is_array($hook_data))
                                    {
                                        foreach($hook_data as $hook)
                                        {
                                            if(is_string($hook) || is_int($hook))
                                            {
                                                echo htmlspecialchars_decode($hook);
                                            }
                                        }
                                    }
                                {{/php}}
                            </td>
                        </tr>
                    {{/foreach}}
                {{/if}}
            </tbody>
        </table>
        {{if empty($data_list)}}
            <div class="table-no"><i class="am-icon-warning"></i> 没有相关数据</div>
        {{/if}}
        <!-- list end -->

        <!-- bottom operation start -->
        <div class="am-g am-margin-top-sm">
            <!-- 底部操作钩子 -->
            {{if isset($shopxo_is_develop) and $shopxo_is_develop eq true and (!isset($is_footer) or $is_footer eq 1)}}
                <div class="plugins-tag">
                    <span>plugins_view_admin_goods_comments_bottom_operation</span>
                </div>
            {{/if}}
            {{php}}
                $hook_name = 'plugins_view_admin_goods_comments_bottom_operation';
                $hook_data = Hook::listen($hook_name, ['hook_name'=>$hook_name, 'is_backend'=>true]);
                if(!empty($hook_data) && is_array($hook_data))
                {
                    foreach($hook_data as $hook)
                    {
                        if(is_string($hook) || is_int($hook))
                        {
                            echo htmlspecialchars_decode($hook);
                        }
                    }
                }
            {{/php}}
        </div>
        <!-- bottom operation end -->

        <!-- 处理窗口 -->
        <div class="am-popup am-radius" id="my-popup-reply">
            <div class="am-popup-inner">
                <div class="am-popup-hd">
                    <h4 class="am-popup-title">回复</h4>
                    <span data-am-modal-close class="am-close">&times;</span>
                </div>
                <div class="am-popup-bd">
                    <dl class="dl-content">
                        <dt>商品信息</dt>
                        <dd class="goods-info">
                            <div class="base">
                                <a href="javascript:;" target="_blank">
                                    <img src="{{$attachment_host}}/static/common/images/user-img-sm.gif" class="am-img-thumbnail am-radius am-align-left" />
                                </a>
                                <a class="am-text-top title" href="javascript:;" target="_blank">...</a>
                            </div>
                            <p class="price">...</p>
                        </dd>

                        <dt>用户信息</dt>
                        <dd class="user-info">
                            <img src="{{$attachment_host}}/static/common/images/user-img-sm.gif" class="am-img-thumbnail am-radius am-align-left" />
                            <ul class="user-base">
                                <li class="username">名称：<span>...</span></li>
                                <li class="nickname">昵称：<span>...</span></li>
                                <li class="mobile">手机：<span>...</span></li>
                                <li class="email">邮箱：<span>...</span></li>
                            </ul>
                        </dd>
                        <dt>评论内容</dt>
                        <dd class="content">...</dd>
                    </dl>

                    <form class="am-form form-validation-reply" action="{{:MyUrl('admin/goodscomments/reply')}}" method="POST" request-type="ajax-reload">
                        <div class="am-form-group">
                            <label>回复内容</label>
                            <textarea name="reply" rows="5" class="am-radius" placeholder="回复内容格式 1~230 个字符" data-validation-message="回复内容格式 1~230 个字符" minlength="1" maxlength="230" required></textarea>
                        </div>

                        <div class="am-form-group reply-submit am-form-group-refreshing t-c">
                            <input type="hidden" name="id" value="" />
                            <button type="submit" class="am-btn am-btn-success am-radius am-btn-sm" data-am-loading="{loadingText:'处理中...'}">回复</button>
                        </div>
                    </form>
                </div>
            </div>
        </div>

        <!-- page start -->
        {{if !empty($data_list)}}
            {{$page_html|raw}}
        {{/if}}
        <!-- page end -->
    </div>
</div>
<!-- right content end  -->
        
<!-- footer start -->
{{include file="public/footer" /}}
<!-- footer end -->